<!DOCTYPE html>
<html >
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta name="apple-wap-web-app-capable" content="yes">
	<meta name="apple-wap-web-app-status-bar-style" content="black-translucent">
	<title>购物车 </title>
	<script src="common/js/cart/jquery-1.10.2.min.js"></script>
	<link rel="stylesheet" href="common/css/cart/ionic.min.css">
	<link rel="stylesheet" href="common/css/cart/main.css">
	<link rel="stylesheet" href="common/css/cart/share.css">
	<link rel="stylesheet" href="common/css/signin.css">
	<link rel="stylesheet" href="common/css/cart/weixin.css">
	<script src="common/js/cart/rentOrder.js"></script>
	<script src="common/js/cart/ionic.bundle.min.js"></script>
	<script src="common/js/cart/runend.js"></script>
	<script src="common/js/AjaxJson.js"></script>
	<link rel="stylesheet" href="common/css/layui.css">
	<link rel="stylesheet" href="common/font/iconfont.css">
	<link rel="stylesheet" href="common/css/demo.css">
	<script src="common/font/iconfont.js"></script>

	<script type="text/javascript">
//定义全局变量
var i=0;

//金额总和
var money=0;

//计算合计价格
var cart_money={};

//全部商品ID
var cart_id={};
//备份商品ID，用于全选后去掉全选又再次全选
var cart_id_copy={};

</script>
	<link rel="stylesheet" href="common/css/style.css">


</head>
<body>
<div class="box">
<header class="zyw-header">
	<div class="zyw-container white-color">
		<div class="head-l">
			<a href="javascript:window.history.back(-1)" target="_self"><img src="common/images/head-return.svg" alt=""></a>
		</div>
		<!--<h1><a href="#" class="active">商品</a><a href="#item-precent">详情</a><a href="">评价</a></h1>-->
		<!--<div class="head-r"><img src="img/svg/head-more.svg" alt=""></div>-->
	</div>
</header>
	<div style="height:44px;"></div>
	
<div  id="cart_form" >
		<!--list-->

		<!--商品列表-->
		<div class="commodity_box">
			<div class="commodity_list">
                <ul class="commodity_list_term">

                </ul>
			</div>
		</div>
</div>
    <div style="height:30px;"></div>
    <footer class="aui-footer">
		<a href="index.html" class="aui-tabBar-item">
                    <span class="aui-tabBar-item-icon">
                        <!--<i class="icon icon-index"></i>-->
						<!--<i class="layui-icon" style="color: #1E9FFF;">&#xe68e;</i>-->
						<li class="dib">
                            <span class="icon iconfont">&#xe73d;</span>
                        </li>
                        <!--<li class="dib">
                            <svg class="icon svg-icon" aria-hidden="true">
                                <use xlink:href="#icon-shouye"></use>
                            </svg>
                        </li>-->
                    </span>
			<span class="aui-tabBar-item-text">首页</span>
		</a>
		<a href="rentCart.html" class="aui-tabBar-item ">
                    <span class="aui-tabBar-item-icon">
                        <!--<i class="icon icon-cart"></i>-->
						<!--<i class="layui-icon">&#xe657;</i>-->
                        <li class="dib">
                            <span class="icon iconfont">&#xe750;</span>
                        </li>
						<!--<li class="dib">
                            <svg class="icon svg-icon" aria-hidden="true">
                                <use xlink:href="#icon-gouwu"></use>
                            </svg>
                        </li>-->
                    </span>
			<span class="aui-tabBar-item-text">购物车</span>
		</a>
		<a href="rentOrder.html" class="aui-tabBar-item ">
                    <span class="aui-tabBar-item-icon">
                        <!--<i class="icon icon-order"></i>-->
						<!--<i class="layui-icon">&#xe60a;</i>-->
                        <!--<li class="dib">
                            <span class="icon iconfont">&#xe749;</span>
                        </li>-->
						<li class="dib">
                            <svg class="icon svg-icon" aria-hidden="true">
                                <use xlink:href="#icon-dingdan"></use>
                            </svg>
                        </li>
                    </span>
			<span class="aui-tabBar-item-text">订单</span>
		</a>
		<a href="personal.html" class="aui-tabBar-item ">
                    <span class="aui-tabBar-item-icon">
                        <!--<i class="icon icon-home"></i>-->
						<!--<i class="layui-icon">&#xe770;</i>-->
                        <li class="dib">
                            <span class="icon iconfont">&#xe743;</span>
                        </li>
						<!--<li class="dib">
                            <svg class="icon svg-icon" aria-hidden="true">
                                <use xlink:href="#icon-wode"></use>
                            </svg>
                        </li>-->
                    </span>
			<span class="aui-tabBar-item-text">个人中心</span>
		</a>

	</footer>
</div>
     
     
     <script>
       var noX = 0;  /* 没选中时点击加减计算数量  */
       var allThis = $(".commodity_box .select em"); /*底部全选*/
  		/* 减  */
  		function reduceMod(e,totalH,mod,noX){
  			var tn = e.siblings().find(".rent_money").text(); /* 当前选中商品  */
  		//	var tn1 = e.siblings().find(".zi").text(); /* 商品数量  */
  			if(mod != 2){
  				var Total = parseFloat(totalH) - (tn);	/* 总价格减该商品总数价格  */
  	  			$("#total_price b").text(Total.toFixed(2));
  			}else{
  				/* 合计加单价-1 */
  				var Total = parseFloat(totalH) - parseFloat(tn);	/* 总价格减该商品总数价格  */
  	  			$("#total_price b").text(Total.toFixed(2));
  			}

}
       /* 加  */
  		function plusMod(e,totalH,mod){
  			var tn = e.siblings().find(".rent_money").text(); /* 当前选中商品  */

  			//var tn1 = e.siblings().find(".zi").text(); /* 商品数量  */
			//alert(mod);
  			if(mod != 2){
  				var Total = parseFloat(totalH) + parseFloat(tn);	/* 总价格加上该商品总数价格  */
                //alert(Total);
  	  			$("#total_price b").text(Total.toFixed(2));

  			}else{
  				/* 合计加单价+1 */
  				var Total = parseFloat(totalH)+(parseFloat(tn)+(noX-1));	/* 总价格加上该商品总数价格  */
                //alert(Total.toFixed(2));
  	  			$("#total_price b").text(Total.toFixed(2));
  			}

}

       /*全部商品价格*/
  		function commodityWhole() {
  			/* 合计金额  */
			var je = $(".commodity_box .select .rent_money"); /* 全部商品单价  */
		//	var je1 = $(".commodity_box .select .zi");  /* 全部商品数量  */
			var TotalJe = 0;
			for(var i=0; i<je.length; i++)
			{
				var n = je.eq(i).text();
		//		var n1 = je1.eq(i).text();
		//		TotalJe = TotalJe + (parseFloat(n)*parseFloat(n1));
				TotalJe += parseFloat(n);
				
			}
			$("#total_price b").text(TotalJe.toFixed(2)); /* 合计金额  */
        }
  		/* 底部全选  */
  		
  		var bot = 0;


  		$("#all_pitch_on").click(function(){
  			if(bot == 0){
  				$(this).addClass("pitch_on");
  				allThis.removeClass("pitch_on");
  				allThis.addClass("pitch_on");
  				/*总价格*/
  				commodityWhole();
  				bot = 1;
  				//重新加入属性对象
  				for(var key in cart_id_copy){
  					cart_id[key]="";
  				}
  			}else{
  				$(this).removeClass("pitch_on");
  				allThis.removeClass("pitch_on");
  				$("#total_price b").text("0");
  				bot = 0;
  				//移除全部对象
  				for(var key in cart_id){
  					delete cart_id[key];
  				}
  			}
  			//计算选择数值
  			number();
  		});
  		
  		function number() {
  			var num=0;
  			for(var key in cart_id){
					num++;
				}
  			//将选择的放入到计算里面
  			//$("#confirm_cart").html("结算("+num+")");
		}
  		
  		/* 编辑商品  */
  		var topb = 0;
  		$("#rem_s").click(function(){
  			if(topb == 0){
  				$(this).text("完成");
  				$(".total_amount").hide(); /* 合计  */
  				$("#confirm_cart").hide(); /* 结算  */
  				$("#confirm_cart1").show(); /* 删除 */
  				topb = 1;
  			}else{
  				topb = 0;
  				$(this).text("编辑");
  				$(".total_amount").show(); /* 合计  */
  				$("#confirm_cart").show(); /* 结算  */
  				$("#confirm_cart1").hide(); /* 删除 */
  				allThis.removeClass("pitch_on"); /* 取消所有选择  */
  				$("#all_pitch_on").removeClass("pitch_on"); /* 取消所有选择  */
  				$("#total_price b").text("0"); /*合计价格清零*/

  			}
  			
  		});

	</script>
</body>
</html>